Conversation
eb5da59 to
cba04f0
Compare
|
Hi @Cali0707 thanks for the review. You're right. We are still working on it, which is why we marked it as WIP, and it's likely we'll find something else. We won't be able to verify everything until Kiali 2.24 is released next Monday. |
69abe42 to
0217d00
Compare
3ea7cf9 to
6fcba0a
Compare
|
Hi @Cali0707 ! This isr eady. Can we run it? |
2d5d4cf to
fcbcaf8
Compare
|
/run-mcpchecker kiali |
mcpchecker MCP Evaluation ResultsCommit:
|
Cali0707
left a comment
There was a problem hiding this comment.
Overall this refactor looks fine to me. I also understand the concerns around duplicated logic for these tools.
I guess my only two worries would be around if there will be any issues with versioning this MCP server vs. the kiali one (what happens if the kiali backend updates and has different params, but the user doesn't update the MCP server or vice-versa?), as well as how the kiali endpoint mixes with the multi cluster support
One interesting approach we have seen downstream is having the toolset be an external dependency that is imported into the server, maybe that would be another option that would at least solve the versioning issues?
That is actually why we opted for this approach; by doing it this way, the Kiali endpoints remain fixed for this specific use case, which avoids potential versioning mismatches. Regarding the external toolset dependency, I think it's a great idea. It’s definitely an option worth exploring to keep things modular |
4982305 to
89c06ac
Compare
Signed-off-by: Alberto Gutierrez <aljesusg@gmail.com>
header Signed-off-by: Alberto Gutierrez <aljesusg@gmail.com>
Signed-off-by: Alberto Gutierrez <aljesusg@gmail.com>
89c06ac to
8451eb8
Compare
Signed-off-by: Alberto Gutierrez <aljesusg@gmail.com>
2120fc7 to
721e590
Compare
Ready
Summary
/api/chat/mcp/*endpoints instead of implementing the logic locallyMotivation
Kiali's UI already ships a built-in chatbot that uses the same MCP tool semantics. Maintaining two independent implementations of the same tools — one in the Kiali backend and one here in the MCP server — created several problems:
What changed
Architecture
Before: each tool handler built REST API calls to multiple Kiali endpoints, parsed JSON responses, computed derived data (health rollups, graph merges), and formatted output.
After: each tool handler is a thin wrapper that POSTs to
<kiali-url>/api/chat/mcp/<tool_name>with the tool arguments as JSON. Kiali's backend owns all data fetching, aggregation, and LLM-optimized formatting.Deleted (~3,000 lines)
pkg/kiali/: 15 files removed —health_calculation.go(626 lines),get_mesh_graph.go,graph.go,traces.go,logs.go,services.go,workloads.go,istio.go,mesh.go,namespaces.go,validations.go,types.go,endpoints.go, etc.pkg/toolsets/kiali/: 7 files removed —get_mesh_graph.go,get_metrics.go,get_resource_details.go,get_traces.go,helpers.go,helpers_test.go,logs.go,manage_istio_config.goAdded
pkg/toolsets/kiali/tools/: 9 thin tool handlers (~60–90 lines each) that define the tool schema and delegate tokiali.ExecuteRequest()pkg/toolsets/kiali/tools/endpoints.go: centralized MCP endpoint path constantspkg/toolsets/kiali/internal/defaults/: shared default values for tool parameterspkg/kiali/tests/: endpoint coverage test ensuring every endpoint constant is wired to a tool implementation, plus backend contract test scaffoldingImproved test coverage
kiali_test.go: no-config initialization, empty endpoint, non-2xx error handling (with/without body), JSON body serialization, header assertions (Content-Type,X-Kubernetes-MCP-Server, POST method), Bearer token edge cases (empty, already-prefixed)config_test.go: directValidate()tests for nil config, empty URL, invalid URL, URL without scheme, HTTP vs HTTPS certificate requirementspkg/mcp/kiali_test.go: rewritten to test the new architecture (single POST per tool, MCP endpoint paths, JSON argument forwarding)Benefits
Test plan
make testpasses (all 25 packages green)Summary evals
=== Evaluation Summary ===
✓ Create Istio Gateway (assertions: 3/3)
✓ Remove Fault Injection (assertions: 3/3)
✓ List and Validate VirtualServices (assertions: 3/3)
✓ List and Validate DestinationRules (assertions: 3/3)
✓ Update Traffic Shifting (assertions: 3/3)
✓ Analyze Service Traffic Volume (assertions: 3/3)
✓ Analyze Workload Response Times (assertions: 3/3)
✓ Identify Degraded Namespaces (assertions: 3/3)
✓ List Mesh-Enabled Namespaces (assertions: 3/3)
✓ Inspect Service Details (assertions: 3/3)
✓ Inspect Workload Details (assertions: 3/3)
✓ Inventory Namespace Services (assertions: 3/3)
✓ Inventory Workloads with Sidecar Status (assertions: 3/3)
✓ Comprehensive Mesh Health Audit (assertions: 3/3)
✓ Visualize Namespace Traffic (assertions: 3/3)
✓ Audit Control Plane Connectivity (assertions: 3/3)
✓ Visualize Cross-Namespace Traffic (assertions: 3/3)
✓ Visualize Workload-Level Topology (assertions: 3/3)
✓ Debug Service Errors via Logs (assertions: 3/3)
✓ Analyze Latency with Distributed Tracing (assertions: 3/3)
✓ Retrieve Recent Workload Logs (assertions: 3/3)
Tasks: 21/21 passed (100.00%)
Assertions: 63/63 passed (100.00%)
Tokens: ~82147 (incomplete - some counts failed)
MCP schemas: ~59787 (included in token total)
Judge used tokens:
Input: 98980 tokens
Output: 3199 tokens